/**
 * Collaborative Story Development Web Application (CSDApp) 
 * Copyright Anton Strack 2014
 *
 * This file is part of Collaborative Story Development Application (CSDApp).
 *
 * CSDApp is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or any later version.
 *
 * CSDApp is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * CSDApp. If not, see <http://www.gnu.org/licenses/>.
 *
 */
package csdwa;

import java.sql.Timestamp;

/**
 * This class represents a base post type.
 *
 * @author Anton Strack
 */
public class Post extends Resource implements CsdwaRecordable, CsdwaNotifiable {

    /**
     * The name of the post as seen by the end user.
     */
    private String name;
    /**
     * The description / summery of the post as seen by the end user and
     * displayed in index views.
     */
    private String description;
    /**
     * The body content of the post as seen by the end user.
     */
    private String body;
    /**
     * The state of the post according to the workflow setup.
     */
    private int stateId = -1;
    /**
     * The resource id of the previous version of this post after it was
     * updated. This variable provides a means to archive old versions of a post
     * and and view or revert back to a previous version. The parentId value
     * forms a chain of previous versions with 0 indicating no older versions.
     */
    private int parentId = -1;
    /**
     * The user id of who updated the post
     */
    private int updatedById;
    /**
     * The timestamp the post was updated
     */
    private Timestamp updatedDate;
    /**
     * The user id of who created the post and thus owns the post.
     */
    private int createdById;
    /**
     * The timestamp the post was created
     */
    private Timestamp createdDate;

    /**
     * Default no argument bean constructor. Normal client code should not
     * instantiate with this no argument constructor.
     */
    public Post() {
        super();
    }

    /**
     * Default constructor for post resources.
     *
     * @param resourceTypeId
     */
    public Post(int resourceTypeId) {
        super(resourceTypeId);
    }

    /**
     * The name of the post as seen by the end user.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * The name of the post as seen by the end user.
     *
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * The description / summery of the post as seen by the end user and
     * displayed in index views.
     *
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * The description / summery of the post as seen by the end user and
     * displayed in index views.
     *
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * The body content of the post as seen by the end user.
     *
     * @return the body
     */
    public String getBody() {
        return body;
    }

    /**
     * The body content of the post as seen by the end user.
     *
     * @param body the body to set
     */
    public void setBody(String body) {
        this.body = body;
    }

    /**
     * The state of the post according to the workflow setup.
     *
     * @return the stateId
     */
    public int getStateId() {
        return stateId;
    }

    /**
     * The state of the post according to the workflow setup.
     *
     * @param stateId the stateId to set
     */
    public void setStateId(int stateId) {
        this.stateId = stateId;
    }

    /**
     * The resource id of the previous version of this post after it was
     * updated. This variable provides a means to archive old versions of a post
     * and and view or revert back to a previous version. The parentId value
     * forms a chain of previous versions with 0 indicating no older versions.
     *
     * @return the parentId
     */
    public int getParentId() {
        return parentId;
    }

    /**
     * The resource id of the previous version of this post after it was
     * updated. This variable provides a means to archive old versions of a post
     * and and view or revert back to a previous version. The parentId value
     * forms a chain of previous versions with 0 indicating no older versions.
     *
     * @param parentId the parentId to set
     */
    public void setParentId(int parentId) {
        this.parentId = parentId;
    }

    /**
     * The user id of who updated the post
     *
     * @return the updatedById
     */
    public int getUpdatedById() {
        return updatedById;
    }

    /**
     * The user id of who updated the post
     *
     * @param updatedById the updatedById to set
     */
    public void setUpdatedById(int updatedById) {
        this.updatedById = updatedById;
    }

    /**
     * The timestamp the post was updated
     *
     * @return the updatedDate
     */
    public Timestamp getUpdatedDate() {
        return updatedDate;
    }

    /**
     * The timestamp the post was updated
     *
     * @param updatedDate the updatedDate to set
     */
    public void setUpdatedDate(Timestamp updatedDate) {
        this.updatedDate = updatedDate;
    }

    /**
     * The user id of who created the post and thus owns the post.
     *
     * @return the createdById
     */
    public int getCreatedById() {
        return createdById;
    }

    /**
     * The user id of who created the post and thus owns the post.
     *
     * @param createdById the createdById to set
     */
    public void setCreatedById(int createdById) {
        this.createdById = createdById;
    }

    /**
     * The timestamp the post was created
     *
     * @return the createdDate
     */
    public Timestamp getCreatedDate() {
        return createdDate;
    }

    /**
     * The timestamp the post was created
     *
     * @param createdDate the createdDate to set
     */
    public void setCreatedDate(Timestamp createdDate) {
        this.createdDate = createdDate;
    }

    @Override
    public String toString() {
        return "Post{" + "name=" + name + ", description=" + description + ", body=" + body + ", stateId=" + stateId + ", parentId=" + parentId + ", updatedById=" + updatedById + ", updatedDate=" + updatedDate + ", createdById=" + createdById + ", createdDate=" + createdDate + '}';
    }
}
